package com.evan.common.controller;

import com.evan.common.pojo.Cluster;
import com.evan.common.service.ClusterService;
import com.evan.common.service.impl.ClusterServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cluster")
@Api("集群操作")
public class ClusterController {

    @Autowired
    ClusterService cs = new ClusterServiceImpl();

    @GetMapping("/addCluster")
    @ApiOperation("添加集群")
    public List<Cluster> addCluster(Cluster cluster){
        cs.addCluster(cluster);
        return cs.getAllCluster();
    }
    @GetMapping("/allCluster")
    @ApiOperation("获取所有集群")
    public List<Cluster> getCluster(){
        return cs.getAllCluster();
    }

}
